package com.hzm.controller;

import com.hzm.bean.User;
import com.hzm.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class UserController {

    @Autowired(required = false)
    UserMapper userMapper;

    @ResponseBody
    @RequestMapping("/user/{id}")
    public User getUserById(@PathVariable("id") Integer id){
        return userMapper.getUserById(id);
    }

    @ResponseBody
    @RequestMapping("/insert")
    public int insertUser(User user){
        return userMapper.insertUser(user);
    }
}
